import ConfigParser   
import string, os, sys   

cf = ConfigParser.ConfigParser()   
cf.read("test.config")   
s = cf.sections()   
print 'section:', s   
o = cf.options("db")   
print 'options:', o   
v = cf.items("db")   
print 'db:', v   
print '-'*60   
db_host = cf.get("db", "db_host")   
#getint() will return a number
db_port = cf.getint("db", "db_port")   
db_user = cf.get("db", "db_user")   
db_pass = cf.get("db", "db_pass")  
print db_host
print type(db_host)
print db_port
print type(db_port)
print db_user
print db_pass
